package cn.kevinproject.dingtalk_robot.msg;

import com.dingtalk.api.request.OapiRobotSendRequest;
import lombok.*;

import java.io.Serializable;

/**
 * @author kevin lau
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@AllArgsConstructor
public class SingleActionCardMessage extends ActionCardMessage implements Serializable {

    private String singleTitle;

    private String singleUrl;



    public SingleActionCardMessage() {
        this.msgType = "actionCard";
    }

    @Override
    public OapiRobotSendRequest buildRequest() {
        val request = super.buildRequest();
        val actionCard = new  OapiRobotSendRequest.Actioncard();
        actionCard.setBtnOrientation(getBtnOrientation());
        actionCard.setSingleTitle(getSingleTitle());
        actionCard.setSingleURL(getSingleUrl());
        actionCard.setText(getText());
        actionCard.setTitle(getTitle());
        request.setActionCard(actionCard);
        return request;
    }
}
